package com.mDigitalHealth.http;

import java.util.LinkedHashMap;
import java.util.Map;

import org.json.simple.JSONValue;
import org.json.simple.parser.JSONParser;

public class RegResponse {
	// 电话号
	private String munber;
	// 内容
	private String content;

	public RegResponse() {
		munber = "";
		content = "";
	}

	public RegResponse(String munber, String content) {
		this.munber = "";
		this.content = "";
	}

	public String getMunber() {
		return munber;
	}

	public void setMunber(String munber) {
		this.munber = munber;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String encode() {
		try {
			LinkedHashMap map = new LinkedHashMap();

			map.put("munber", this.munber);
			map.put("content", this.content);

			return JSONValue.toJSONString(map);
		} catch (Exception e) {
		}
		return null;
	}

	public int decode(String strCode) {
		try {
			if (strCode == null) {
				return -1;
			}
			JSONParser parser = new JSONParser();
			Map map = (Map) parser.parse(strCode);
			this.munber = ((String) map.get("munber"));
			this.content = ((String) map.get("content"));

			return 1;
		} catch (Exception e) {
		}
		return -1;
	}
}
